import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class a1 {
    public int minCost (int N, int[][] roads) {

        //0 1 3 5
        Union unji=new Union(N);
        return 0;
    }
    class Union{
        private int[] parent;
        private int[] size;
        int count;
        public Union(int n){
            count=n;
            parent=new int[n];
            size=new int[n];
            for(int i=0;i<n;i++){
                parent[i]=i;
                size[i]=1;
            }
        }
        public int find(int node){
            while (parent[node] != node) {
                parent[node] = parent[parent[node]];
                node = parent[node];
            }
            return node;
        }
        public boolean connected(int i,int j){
            return find(i)==find(j);
        }
        public int getCount() {
            return count;
        }
        public void un(int p,int q){
            int a=find(p);
            int b=find(q);
            if(a==b)return;
            if(size[a]<=size[b]){
                size[b]+=size[a];
                parent[a]=b;
            }else{
                size[a]+=size[b];
                parent[b]=a;
            }
            count--;
        }
    }
}
